﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Windows.Forms.Integration;

namespace SpaceFight
{
	public partial class UnitSettingsSliders : Form
	{
		public UnitSettingsSliders()
		{
			InitializeComponent();
		}
		public void AddSlider(string name, SliderSettings p_settings)
		{
			// do some checking for valid property name
			System.Reflection.PropertyInfo info = p_settings.Object.GetType().GetProperty(p_settings.Property);
			if(info.CanWrite == false) return;
			if(info.PropertyType != 0.1F.GetType()) return;

			// create new wpf element host
			var elementHost = new ElementHost();
			elementHost.Dock = DockStyle.Right;
			elementHost.AutoSize = true;
			
			elementHost.Child = new SettingSlider(name, p_settings);

			this.flowLayoutPanel1.Controls.Add(elementHost);
			this.Show();
		}
	}
}
